//定义三角形
class Triangle {

    double sideA, sideB, sideC;
    boolean isTriangle;
    Triangle(double a, double b, double c) {
        sideA = a;
        sideB = b;
        sideC = c;
        isTriangle = (a + b > c && a + c > b && b + c > a);
    }
    double getPerimeter() {
        return sideA + sideB + sideC;
    }
    double getArea() {
        if (isTriangle) {
            double p = (sideA + sideB + sideC) / 2.0;

            return Math.sqrt(p * (p - sideA) * (p - sideB) * (p - sideC));
        } else {
            System.out.println("不是一个三角形，无法计算面积");
            return 0;
        }
    }
    void setSides(double a, double b, double c) {
        sideA = a;
        sideB = b;
        sideC = c;
        isTriangle = (a + b > c && a + c > b && b + c > a);
    }
}


